Skip to content

feat(react-router): support react router v8#21633

Merged
JPeer264 merged 5 commits into
developfrom
jp/support-react-router-8
Jun 19, 2026
Merged

feat(react-router): support react router v8#21633
JPeer264 merged 5 commits into
developfrom
jp/support-react-router-8

Conversation

@JPeer264

@JPeer264 JPeer264 commented Jun 18, 2026

Copy link
Copy Markdown
Member

closes #21622
closes JS-2800

Basically only packages/react/src/reactrouterv8.tsx has been added to make it work. I copied over 3 tests: -cross-usage, -spa and -framework that covers the exports.

To make it easier to check what actually changed in the apps, I made one commit with the copy and another with the changes. So it might be easier to review only the actual changes: b084c55

Docs will be updated once the PR lands

@JPeer264 JPeer264 self-assigned this Jun 18, 2026
@JPeer264 JPeer264 requested a review from a team as a code owner June 18, 2026 12:18
@JPeer264 JPeer264 requested review from Lms24, chargome, nicohrubec and s1gr1d and removed request for a team June 18, 2026 12:18

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed offline maybe we could simplify this so we don't have to ship one integration per major and instead use one generic one

],
},
// todo: should be 'GET /errors/server-loader'
transaction: 'GET /{*splat}',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a reference, because commit comments are not shown in PRs: b084c55#r189222849

"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "bundler",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a reference, because commit comments are not shown in PRs: b084c55#r189222251

@linear-code

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

JS-2800

@JPeer264 JPeer264 requested a review from nicohrubec June 19, 2026 08:07
@JPeer264 JPeer264 force-pushed the jp/support-react-router-8 branch from 84142b2 to feb5a0d Compare June 19, 2026 08:16
@JPeer264

Copy link
Copy Markdown
Member Author

as discussed offline maybe we could simplify this so we don't have to ship one integration per major and instead use one generic one

As a written update. Now the version additions in the origin are removed. And v6 and v7 exports are deprecated as it would be safe to use the new ones (also 1-2 of the v6 and v7 e2e-tests were updated, to still check against the old, but also against the new export)

The withSentryReactRouterV*Routing has been unified with the wording of the others: wrapReactRouterRouting

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 694f162. Configure here.

const user: User = await getUser();
context.set(userContext, user);
await next();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Middleware omits awaiting startSpan

Medium Severity

The authMiddleware handler invokes Sentry.startSpan without return or await, so the middleware promise can settle before the span callback runs await next(). That breaks the usual React Router middleware contract and can race the loader against context setup or tracing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 694f162. Configure here.

});

await page.goto(`/performance`); // pageload
await page.waitForTimeout(1000); // give it a sec before navigation

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E tests use fixed sleeps

Low Severity

Several new React Router 8 framework performance tests call page.waitForTimeout(1000) before navigation instead of waiting on a concrete telemetry or UI signal. Fixed sleeps are a common source of flaky CI when load timing varies.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 694f162. Configure here.

* Works with React Router v6+.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function wrapReactRouterRouting<P extends Record<string, any>, R extends React.FC<P>>(routes: R): R {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The file uses React.FC in its type definitions without explicitly importing the React namespace, creating an implicit dependency and code inconsistency.
Severity: LOW

Suggested Fix

Add import * as React from 'react'; to the top of packages/react/src/reactrouter.compat.tsx to make the dependency on the React namespace explicit and improve code consistency and maintainability.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/react/src/reactrouter.compat.tsx#L32

Potential issue: The file `reactrouter.compat.tsx` uses the `React.FC` type in its
definitions without an explicit `import * as React from 'react';` statement. While this
may compile successfully due to TypeScript resolving `React` as a global type from
ambient declarations, it creates an implicit dependency on the toolchain's
configuration. This is inconsistent with other files like `reactrouter.tsx` which do
import React, making the code less maintainable and potentially brittle to future build
system changes.

Did we get this right? 👍 / 👎 to inform future reviews.

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@JPeer264 JPeer264 enabled auto-merge (squash) June 19, 2026 09:00
@JPeer264 JPeer264 merged commit 9c765e0 into develop Jun 19, 2026
124 checks passed
@JPeer264 JPeer264 deleted the jp/support-react-router-8 branch June 19, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for React Router v8

2 participants